<section class="todo-header">
  <form name="form" novalidate>
    <input
      name="content"
      type="text"
      ng-model="content"
      ng-keyup="$event.keyCode === 13 && addItem()"
      required
      validate-todo-content
      placeholder="待办事项..."
    >
    <button type="submit" ng-click="addItem()">Add</button>
    <button type="button" ng-click="clear()">Clear</button>
    <button type="button" ng-click="changeOrder()">Change Order</button>
  </form>
  <div ng-show="form.$dirty" class="err-msg">
    <div ng-show="form.content.$error.required">请输入待办事项</div>
    <div ng-show="form.content.$error.todoContent">只能输入数字和英文字母</div>
  </div>
</section>
<style>
.todo-header input.ng-invalid.ng-touched {
  border-color: red;
}
.todo-header .err-msg {
  font-size: .75rem;
  color: red;
}
</style>